def ck_postbox():
    import re
    while True:
        input_postbox = input("请输入邮箱：")
        postbox = re.compile(r"^(?:\w){6,18}@[a-zA-Z0-9-]+\.com$")
        if postbox.match(input_postbox):
            print(f"{input_postbox}是合法的")
            break
        else:
            print("您输入的邮箱不合法,请重新输入")
ck_postbox()
